<template>
	<view class="contain">
		<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
			<swiper-item v-for="(item,index) in banner" :key="index">
				<view class="swiper-item">
					<image style="width: 100%;" :src="base+item.advImg" mode="widthFix"></image>
				</view>
			</swiper-item>
		</swiper>
		<!-- 轮播结束 -->
		
		<uni-list>
			<uni-list-chat clickable @click="moveiinfo(item.id)" v-for="(item,index) in bannerlist.slice(0,control)" :title="item.name" :note="item.introduction.replace(/<[^>]+>/g,'')"  :avatar="base+item.cover"></uni-list-chat>
		</uni-list>
	</view>
</template>

<script>
import {getbannermovie,baseURL,getmovielist} from '@/utils/movie/index.js'
	export default {
		data() {
			return {
				banner:[],
				base:"",
				bannerlist:[],
				control:5
			}
		},
		onLoad() {
			this.base=baseURL
			this.getbannermovi()
			this.getmovielis()
		},
		onReachBottom() {
				setTimeout(()=>{
					this.control+=5
				},1000)
		},
		methods: {
			moveiinfo(id){
				uni.navigateTo({
					url:"/pages/movieinfo/movieinfo?id="+id
				})
			},
			async getmovielis(){
				const res = await getmovielist()
				console.log(res)
				this.bannerlist=res.data.rows
			},
			async getbannermovi(){
				const res = await getbannermovie()
				// console.log(res)
				this.banner=res.data.rows
			},
			
		}
	}
</script>

<style>

</style>
